using Lzfy_His_Service.Models;

namespace Lzfy_His_Service.Services
{
    /// <summary>
    /// 银行信息服务接口
    /// </summary>
    public interface IBankInfoService
    {
        /// <summary>
        /// 获取银行信息列表（分页）
        /// </summary>
        /// <param name="request">查询请求</param>
        /// <returns></returns>
        Task<PagedResponse<BankInfoResponse>> GetBankInfoListAsync(BankInfoQueryRequest request);

        /// <summary>
        /// 根据ID获取银行信息详情
        /// </summary>
        /// <param name="id">银行ID</param>
        /// <returns></returns>
        Task<BankInfoResponse?> GetBankInfoByIdAsync(int id);

        /// <summary>
        /// 创建银行信息
        /// </summary>
        /// <param name="request">创建请求</param>
        /// <param name="createdBy">创建人</param>
        /// <returns></returns>
        Task<(bool success, string message, int? bankId)> CreateBankInfoAsync(BankInfoCreateRequest request, string? createdBy = null);

        /// <summary>
        /// 更新银行信息
        /// </summary>
        /// <param name="id">银行ID</param>
        /// <param name="request">更新请求</param>
        /// <param name="updatedBy">更新人</param>
        /// <returns></returns>
        Task<(bool success, string message)> UpdateBankInfoAsync(int id, BankInfoUpdateRequest request, string? updatedBy = null);

        /// <summary>
        /// 删除银行信息
        /// </summary>
        /// <param name="id">银行ID</param>
        /// <param name="deletedBy">删除人</param>
        /// <returns></returns>
        Task<(bool success, string message)> DeleteBankInfoAsync(int id, string? deletedBy = null);

        /// <summary>
        /// 搜索银行信息
        /// </summary>
        /// <param name="keyword">关键词</param>
        /// <param name="limit">限制数量</param>
        /// <returns></returns>
        Task<List<BankSearchResponse>> SearchBankInfoAsync(string keyword, int limit = 10);

        /// <summary>
        /// 验证银行卡信息
        /// </summary>
        /// <param name="request">验证请求</param>
        /// <returns></returns>
        Task<BankCardValidationResponse> ValidateBankCardAsync(BankCardValidationRequest request);

        /// <summary>
        /// 获取所有启用的银行列表
        /// </summary>
        /// <returns></returns>
        Task<List<BankSearchResponse>> GetAllActiveBanksAsync();

        /// <summary>
        /// 更新银行BIN码映射
        /// </summary>
        /// <param name="bankId">银行ID</param>
        /// <param name="binCodes">BIN码列表</param>
        /// <param name="updatedBy">更新人</param>
        /// <returns></returns>
        Task<(bool success, string message)> UpdateBankBinMappingsAsync(int bankId, List<string> binCodes, string? updatedBy = null);

        /// <summary>
        /// 更新银行别名
        /// </summary>
        /// <param name="bankId">银行ID</param>
        /// <param name="aliases">别名列表</param>
        /// <param name="updatedBy">更新人</param>
        /// <returns></returns>
        Task<(bool success, string message)> UpdateBankAliasesAsync(int bankId, List<BankAliasRequest> aliases, string? updatedBy = null);

        /// <summary>
        /// 获取银行变更日志
        /// </summary>
        /// <param name="bankId">银行ID（可选）</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns></returns>
        Task<PagedResponse<BankInfoChangeLog>> GetChangeLogsAsync(int? bankId = null, int pageIndex = 1, int pageSize = 20);

        /// <summary>
        /// 导出银行信息数据
        /// </summary>
        /// <returns></returns>
        Task<List<BankInfoResponse>> ExportBankInfoAsync();

        /// <summary>
        /// 导入银行信息数据
        /// </summary>
        /// <param name="bankInfoList">银行信息列表</param>
        /// <param name="importedBy">导入人</param>
        /// <returns></returns>
        Task<(bool success, string message, int successCount, int failCount)> ImportBankInfoAsync(
            List<BankInfoCreateRequest> bankInfoList, string? importedBy = null);
    }
}